# Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>

pkgname=networkmanager-fortisslvpn
pkgver=1.4.0
pkgrel=2
pkgdesc="NetworkManager VPN plugin for Fortinet SSLVPN"
url="https://wiki.gnome.org/Projects/NetworkManager"
arch=(loong64 x86_64)
license=(GPL)
_pppver=2.4.9
depends=(libnm libsecret "ppp=$_pppver" openfortivpn)
makedepends=(libnma libnma-gtk4 intltool python git)
optdepends=('libnma: GUI support (GTK 3)'
            'libnma-gtk4: GUI support (GTK 4)')
options=(debug)
_commit=308987d45faee919e54547eb7ff0120c32c5a84e  # tags/1.4.0^0
source=("git+https://gitlab.gnome.org/GNOME/NetworkManager-fortisslvpn.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd NetworkManager-fortisslvpn
  git describe --tags | sed 's/-dev/dev/;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd NetworkManager-fortisslvpn
  intltoolize --automake --copy
  autoreconf -fvi
}

build() {
  cd NetworkManager-fortisslvpn
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --libexecdir=/usr/lib --disable-static --with-gtk4 \
    --with-pppd-plugin-dir=/usr/lib/pppd/$_pppver
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd NetworkManager-fortisslvpn
  make DESTDIR="$pkgdir" install dbusservicedir=/usr/share/dbus-1/system.d
}

# vim:set sw=2 et:
